const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
const FileManagerWebpackPlugin = require("filemanager-webpack-plugin");

module.exports = {
  mode: "development",
  // devtool: "inline-source-map",
  devtool: false,
  plugins: [
    new HtmlWebpackPlugin({
      template: "./src/index.html",
    }),
    new webpack.SourceMapDevToolPlugin({
      filename: "[file].map",
      // append: "\n//# sourceMappingUrl=http://127.0.0.1:8081/[url]",
      append: false,
    }),
    new FileManagerWebpackPlugin({
      events: {
        onEnd: {
          copy: [
            {
              source: "./dist/*.map",
              destination: path.resolve("./sourcemaps"),
            },
          ],
          delete: ["./dist/*.map"],
        },
      },
    }),
  ],
  output: {
    clean: true,
  },
};
